package giftmail.util;

import java.util.Properties;

import org.apache.commons.lang.StringUtils;

/**
 * 配置文件加载工具类
 * @author Demo
 */
public class PropertiesUtil {
	public static String getProperty(String key) {
		try {
			Properties properties = null;
			if (properties == null) {
				properties = new Properties();
			}
			properties.load(PropertiesUtil.class.getClassLoader().getResourceAsStream("config.properties"));
			if (StringUtils.isBlank((String) properties.get(key))) {
				properties.load(PropertiesUtil.class.getClassLoader().getResourceAsStream("jdbc.properties"));
			}
			return (String) properties.get(key);
		} catch (Exception e) {
			e.printStackTrace();
			return null;
		}

	}
}
